'''第一关 将文本解密

    解密方式是将字母后移两位

    加密文本为：
    g fmnc wms bgblr rpylqjyrc gr zw fylb. 
    rfyrq ufyr amknsrcpq ypc dmp. 
    bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. 
    sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.
'''
import string
# 待解密的文本
text = '''g fmnc wms bgblr rpylqjyrc gr zw fylb. 
        rfyrq ufyr amknsrcpq ypc dmp. 
        bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. 
        sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'''
# 解密后的文本
text_translate = ''

# for i in text:
#     # 判断该字符是否是字母
#     if str.isalpha(i):
#         # 转为Unicode编码
#         n = ord(i)
#         if i >= 'y':
#             n = ord(i) + 2 - 26
#         else:
#             n = ord(i) + 2
#         text_translate += chr(n)
#     else:
#         text_translate += i

# print(text_translate)

# 使用str.maketrans()方法
l = string.ascii_lowercase
t = str.maketrans(l, l[2:]+l[:2])
text_translate = 'map'.translate(t)
print(text_translate)

